﻿using GamovMvc.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GamovMvc.Controllers
{
    public class ProductController : IController
    {
        private HttpContext currentContext;

        public void Index()
        {
            currentContext.Response.Write("Product index");
        }

        public void Add()
        {
            currentContext.Response.Write("Product Add Success");
        }

        public void Execute(HttpContextBox contextBox)
        {
            currentContext = contextBox.Context;
            string actionName = "index";
            if (contextBox.RouteData.ContainsKey("{action}"))
            {
                actionName = contextBox.RouteData["{action}"];
            }

            switch (actionName)
            {
                case "index":
                    Index();
                    break;
                case "add":
                    Add();
                    break;
                default:
                    break;
            }


        }
    }
}